<html>
<head><meta charset="utf-8"><title>preserving debuginfo in optimizations · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html">preserving debuginfo in optimizations</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="187708937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187708937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187708937">(Feb 08 2020 at 09:06)</a>:</h4>
<blockquote>
<p>will make debugging hard/impossible</p>
</blockquote>
<p>this shouldn't be a thing. perfect debuginfo preservation was the blocker for my SROA and NRVO optimizations</p>



<a name="187709597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187709597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187709597">(Feb 08 2020 at 09:26)</a>:</h4>
<p>please talk to me about things like that, I think one of the goals is (or used to be?) that optimized libraries should still be "perfectly debuggable" (although this mostly matters for libcore...libstd)</p>



<a name="187709605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187709605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187709605">(Feb 08 2020 at 09:27)</a>:</h4>
<p>although idk if this topic is the best one to discuss this in lol</p>



<a name="187710906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187710906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187710906">(Feb 08 2020 at 10:12)</a>:</h4>
<p>Perfect debuginfo preservation limits optimizations though =P</p>



<a name="187712836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187712836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187712836">(Feb 08 2020 at 11:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116466">@Zoxc</span> common misconception :P</p>



<a name="187712848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187712848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187712848">(Feb 08 2020 at 11:17)</a>:</h4>
<p>AFAICT you might even be able to run a loop to compute a value in the debugger, which was completely optimized out in the actual program</p>



<a name="187712890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187712890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187712890">(Feb 08 2020 at 11:18)</a>:</h4>
<p>one of the main limiting factors here is LLVM</p>



<a name="187712974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187712974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187712974">(Feb 08 2020 at 11:20)</a>:</h4>
<p>(I suggest everyone in wg-mir-opt to skim through <a href="http://www.dwarfstd.org/doc/DWARF5.pdf" target="_blank" title="http://www.dwarfstd.org/doc/DWARF5.pdf">http://www.dwarfstd.org/doc/DWARF5.pdf</a> - I wish I've done it years ago, it's really inspiring to see what's designed to be possible)</p>



<a name="187713116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713116">(Feb 08 2020 at 11:24)</a>:</h4>
<p>I have read a lot of that document already to implement debuginfo in cg_clif. It can be hard to find what you want, but it is likely there, no matter how exotic it is what you want.</p>



<a name="187713134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713134">(Feb 08 2020 at 11:25)</a>:</h4>
<p>I'm kind of curious how you're approaching DWARF, is there some Cranelift abstraction being built by you or anyone else? (presumably you need to map Cranelift instructions to address ranges you can write in the DWARF)</p>



<a name="187713136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713136">(Feb 08 2020 at 11:25)</a>:</h4>
<p><del>(but this is very offtopic lol)</del></p>



<a name="187713743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713743">(Feb 08 2020 at 11:43)</a>:</h4>
<p>Cranelift has a few basic abstractions like:</p>
<ul>
<li>Function.srclocs: mapping from instruction to SourceLoc (an u32)</li>
<li>FunctionBuilder.set_val_label(): mapping from ValueLabel to storage location (register/stack) for each inst</li>
</ul>
<p>On top of those I have built a DWARF writer which uses gimli for the actual encoding. (<a href="https://github.com/bjorn3/rustc_codegen_cranelift/blob/e95a300630ce9f44b363ecc18e78a6f5df410b79/src/debuginfo" target="_blank" title="https://github.com/bjorn3/rustc_codegen_cranelift/blob/e95a300630ce9f44b363ecc18e78a6f5df410b79/src/debuginfo">https://github.com/bjorn3/rustc_codegen_cranelift/blob/e95a300630ce9f44b363ecc18e78a6f5df410b79/src/debuginfo</a>)</p>



<a name="187713853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713853">(Feb 08 2020 at 11:45)</a>:</h4>
<p>For line debuginfo generate a unique SourceLoc for each mir::SourceLoc. To map from Inst to address range, I just use <code>func.inst_offsets</code> on the function after compilation.</p>



<a name="187713968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713968">(Feb 08 2020 at 11:49)</a>:</h4>
<p>that's super cool that Cranelift can give you access to all that</p>



<a name="187713977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187713977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187713977">(Feb 08 2020 at 11:50)</a>:</h4>
<p>I kind of wish the cranelift backend was in-tree and I had more time to help on it, but I'm glad someone's doing it :D</p>



<a name="187714020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714020">(Feb 08 2020 at 11:50)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> btw did you see the clusterfudge that LLVM's SSA value debuginfo is? <a href="https://github.com/rust-lang/rust/issues/68817" target="_blank" title="https://github.com/rust-lang/rust/issues/68817">https://github.com/rust-lang/rust/issues/68817</a></p>



<a name="187714034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714034">(Feb 08 2020 at 11:51)</a>:</h4>
<p>AFAICT there's no way to force LLVM into a mode of "I <em>really</em> want this value computed and kept around because I'm in debug mode" without throwing it onto the stack</p>



<a name="187714038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714038">(Feb 08 2020 at 11:52)</a>:</h4>
<p>Cranelift looks much better positioned to allow this</p>



<a name="187714094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714094">(Feb 08 2020 at 11:53)</a>:</h4>
<p>Yes I saw that. Cranelift currently is not much better, as it also discards values after their last use. Adding a instruction which pretends to read a value to Cranelift may fix  it though.</p>



<a name="187714146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714146">(Feb 08 2020 at 11:54)</a>:</h4>
<p>I haven't spent much time on local debuginfo yet. cg_clif does have some rudimentary support currently, but I disabled it as it doesn't handle much types and value locations.</p>



<a name="187714150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714150">(Feb 08 2020 at 11:54)</a>:</h4>
<p>yeah I think you need to find the last instruction that's in a lexical scope that's nested inside the scope of a variable and add some sort of "debuginfo fence"</p>



<a name="187714154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714154">(Feb 08 2020 at 11:54)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> IMO, all of the type debuginfo should be shared between LLVM and Cranelift</p>



<a name="187714167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714167">(Feb 08 2020 at 11:55)</a>:</h4>
<p>Yeah, I have been planning to do that some day, but I haven't done it yet. I think I will give it a shot today though.</p>



<a name="187714169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714169">(Feb 08 2020 at 11:55)</a>:</h4>
<p>I have some vague ideas of how we might be able to do this, we just need to find an abstraction (probably based around <code>gimli</code>)</p>



<a name="187714206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714206">(Feb 08 2020 at 11:56)</a>:</h4>
<p>(Should we split this out in a new topic)</p>



<a name="187714207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714207">(Feb 08 2020 at 11:56)</a>:</h4>
<p><em>shrug</em></p>



<a name="187714257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714257">(Feb 08 2020 at 11:58)</a>:</h4>
<p>I was thinking about creating a new datastructure, which has the same shape as the output DWARF. I think using gimli will be hard to translate back to LLVM.</p>



<a name="187714271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714271">(Feb 08 2020 at 11:59)</a>:</h4>
<p>I was thinking some kind of API which is easy to emit both LLVM and gimli from. not literally using gimli, that would indeed not be convertable back to LLVM</p>



<a name="187714277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714277">(Feb 08 2020 at 11:59)</a>:</h4>
<p>You mean a trait? That should be possible</p>



<a name="187714279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714279">(Feb 08 2020 at 11:59)</a>:</h4>
<p>yeah like the <code>BuilderMethods</code> trait</p>



<a name="187714428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187714428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187714428">(Feb 08 2020 at 12:04)</a>:</h4>
<p>/me is waiting for git pull to complete so that he can work on this.</p>



<a name="187720288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720288">(Feb 08 2020 at 15:13)</a>:</h4>
<p>At <a href="https://github.com/rust-lang/rust/blob/6cad7542da2f10e2110f942de4db59716bacb3df/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs#L67" target="_blank" title="https://github.com/rust-lang/rust/blob/6cad7542da2f10e2110f942de4db59716bacb3df/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs#L67">https://github.com/rust-lang/rust/blob/6cad7542da2f10e2110f942de4db59716bacb3df/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs#L67</a> I don't understand why skipping the creation of a nested scope can cause shadowing problems.</p>



<a name="187720352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720352">(Feb 08 2020 at 15:15)</a>:</h4>
<p>because you could have the same name twice in the same scope</p>



<a name="187720400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720400">(Feb 08 2020 at 15:16)</a>:</h4>
<p>How? <code>let a; let a;</code> creates the second <code>a</code> in a subscope, right?</p>



<a name="187720410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720410">(Feb 08 2020 at 15:16)</a>:</h4>
<p>That code is only for scopes without variables defined</p>



<a name="187720420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720420">(Feb 08 2020 at 15:17)</a>:</h4>
<p>hmm</p>



<a name="187720469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720469">(Feb 08 2020 at 15:18)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I think that code might be from a time when argument scope wasn't the outermost scope</p>



<a name="187720486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720486">(Feb 08 2020 at 15:19)</a>:</h4>
<p>So I can always perform an early return when there are no variables in a scope?</p>



<a name="187720527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720527">(Feb 08 2020 at 15:20)</a>:</h4>
<p>we should test it</p>



<a name="187720546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720546">(Feb 08 2020 at 15:21)</a>:</h4>
<p>What should be the test?</p>



<a name="187720555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720555">(Feb 08 2020 at 15:21)</a>:</h4>
<p>just change it and see if debuginfo tests pass</p>



<a name="187720558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720558">(Feb 08 2020 at 15:21)</a>:</h4>
<p>I could probably do it right now myself</p>



<a name="187720562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187720562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187720562">(Feb 08 2020 at 15:21)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="187721655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187721655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187721655">(Feb 08 2020 at 15:54)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> seems to work fine :)</p>



<a name="187721680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187721680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187721680">(Feb 08 2020 at 15:55)</a>:</h4>
<p>Thanks for testing. I will remove it then.</p>



<a name="187725427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725427">(Feb 08 2020 at 17:51)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> I included it in <a href="https://github.com/rust-lang/rust/pull/68960" target="_blank" title="https://github.com/rust-lang/rust/pull/68960">https://github.com/rust-lang/rust/pull/68960</a></p>



<a name="187725431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725431">(Feb 08 2020 at 17:51)</a>:</h4>
<p>but what I was working on is <a href="https://github.com/rust-lang/rust/pull/68961" target="_blank" title="https://github.com/rust-lang/rust/pull/68961">https://github.com/rust-lang/rust/pull/68961</a></p>



<a name="187725471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725471">(Feb 08 2020 at 17:52)</a>:</h4>
<p>which I'm excited for, especially if we start doing MIR inlining in debug mode (just very limited)</p>



<a name="187725498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725498">(Feb 08 2020 at 17:53)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> I think we should seriously consider recording calls being inlined, in MIR scope trees</p>



<a name="187725559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725559">(Feb 08 2020 at 17:55)</a>:</h4>
<p>I don't see any reason we can't generate what LLVM inlining generates, in terms of debuginfo</p>



<a name="187725568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187725568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187725568">(Feb 08 2020 at 17:55)</a>:</h4>
<p>it's not like LLVM can tell apart LLVM IR that its own passes generated vs anything else :P</p>



<a name="187727424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187727424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187727424">(Feb 08 2020 at 18:53)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> I included it in <a href="https://github.com/rust-lang/rust/pull/68960" target="_blank" title="https://github.com/rust-lang/rust/pull/68960">https://github.com/rust-lang/rust/pull/68960</a></p>
</blockquote>
<p>I also included it in <a href="https://github.com/rust-lang/rust/issues/68959" target="_blank" title="https://github.com/rust-lang/rust/issues/68959">#68959</a> :) I will wait with marking it as ready until I you're PR is merged and I have some more refactorings towards moving most debuginfo code to cg_ssa.</p>



<a name="187728438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187728438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187728438">(Feb 08 2020 at 19:29)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> <span class="user-mention" data-user-id="133247">@bjorn3</span> I'm now testing a rustc which remembers which MIR scopes came from inlining a call :D</p>



<a name="187728441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187728441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187728441">(Feb 08 2020 at 19:29)</a>:</h4>
<p>no codegen for it, but I might tackle that soon if it's not too asinine</p>



<a name="187728577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187728577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187728577">(Feb 08 2020 at 19:32)</a>:</h4>
<blockquote>
<p><code>error: internal compiler error: src/librustc_mir/shim.rs:99: creating shims from intrinsics (Intrinsic(DefId(2:981 ~ core[9627]::intrinsics[0]::[1]::transmute[0]))) is unsupported</code></p>
</blockquote>



<a name="187728578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187728578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187728578">(Feb 08 2020 at 19:32)</a>:</h4>
<p>lmao</p>



<a name="187730891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187730891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187730891">(Feb 08 2020 at 20:47)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Btw I'd like a flag which disables/enables optimizations that hurt the debugging experience. We kind of need LLVM to obey it to be useful though (unless we get a lot of MIR opts)</p>



<a name="187730899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187730899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187730899">(Feb 08 2020 at 20:47)</a>:</h4>
<p>I definitely want a LLVM mode that makes <code>llvm.dbg.value</code> actually work :P</p>



<a name="187731025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187731025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187731025">(Feb 08 2020 at 20:51)</a>:</h4>
<p>taadaa <a href="https://github.com/rust-lang/rust/pull/68965" target="_blank" title="https://github.com/rust-lang/rust/pull/68965">https://github.com/rust-lang/rust/pull/68965</a></p>



<a name="187731135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187731135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187731135">(Feb 08 2020 at 20:55)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span>  is on <span aria-label="fire" class="emoji emoji-1f525" role="img" title="fire">:fire:</span> today! <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span></p>



<a name="187731258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187731258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187731258">(Feb 08 2020 at 20:58)</a>:</h4>
<p>it's a nice distraction-free weekend :D</p>



<a name="187732655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732655">(Feb 08 2020 at 21:47)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> heh cool that you tried. I wonder if this is a shim or something</p>



<a name="187732695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732695">(Feb 08 2020 at 21:48)</a>:</h4>
<div class="codehilite"><pre><span></span>#0 [optimized_mir] processing
    `&lt;&lt;collections::vec_deque::VecDeque&lt;T&gt; as core::ops::Drop&gt;::drop::Dropper&lt;&#39;a, T&gt; as core::ops::Drop&gt;::drop`
</pre></div>



<a name="187732696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732696">(Feb 08 2020 at 21:48)</a>:</h4>
<p>It's the first thing I think to do when I see a pr touching the inliner lol</p>



<a name="187732697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732697">(Feb 08 2020 at 21:48)</a>:</h4>
<p>We regress far too easily</p>



<a name="187732711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732711">(Feb 08 2020 at 21:49)</a>:</h4>
<p>I believe it's coming from a change in your second commit FYI</p>



<a name="187732713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732713">(Feb 08 2020 at 21:49)</a>:</h4>
<p>bisecting to be sure</p>



<a name="187732759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732759">(Feb 08 2020 at 21:50)</a>:</h4>
<p>I mean, it's clearly inlining this :P <a href="https://github.com/rust-lang/rust/blob/master/src/liballoc/collections/vec_deque.rs#L153" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/liballoc/collections/vec_deque.rs#L153">https://github.com/rust-lang/rust/blob/master/src/liballoc/collections/vec_deque.rs#L153</a></p>



<a name="187732771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732771">(Feb 08 2020 at 21:51)</a>:</h4>
<p>should be easy to repro</p>



<a name="187732882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732882">(Feb 08 2020 at 21:55)</a>:</h4>
<p>ooooh the <code>real_drop_in_place</code> name is gone</p>



<a name="187732997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187732997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187732997">(Feb 08 2020 at 21:58)</a>:</h4>
<p>the param env is wrong here but I doubt that's it <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/instance.rs#L288" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/instance.rs#L288">https://github.com/rust-lang/rust/blob/master/src/librustc/ty/instance.rs#L288</a></p>



<a name="187733016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733016">(Feb 08 2020 at 21:59)</a>:</h4>
<p>oh this is giving me a headache</p>



<a name="187733077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733077">(Feb 08 2020 at 22:00)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> how hard would it be for you to test a small commit?</p>



<a name="187733147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733147">(Feb 08 2020 at 22:03)</a>:</h4>
<p>actually, I take that back, the bug is in instance and/or shim</p>



<a name="187733431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733431">(Feb 08 2020 at 22:13)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> <span class="user-mention" data-user-id="121053">@varkor</span> <span class="user-mention" data-user-id="124288">@oli</span> okay so there's a dark invariant for the <code>InstanceDef</code> variants that have a <code>Ty</code> - all sorts of things can break if the type isn't monomorphic (which means the substs are actually pointless and should always be empty)</p>



<a name="187733528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733528">(Feb 08 2020 at 22:16)</a>:</h4>
<p>actually, no, the substs should be valid for the <code>DefId</code>, but other than that, the monomorphic type restriction should still hold</p>



<a name="187733546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187733546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187733546">(Feb 08 2020 at 22:17)</a>:</h4>
<p>we could do better by extracting a "shallow skeleton", but it's a lot of work I guess</p>



<a name="187734640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187734640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187734640">(Feb 08 2020 at 22:56)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> o/</p>



<a name="187734741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187734741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187734741">(Feb 08 2020 at 22:58)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> not sure I did this Zulip subscribe thing right, does this notify you :P?</p>



<a name="187735471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735471">(Feb 08 2020 at 23:20)</a>:</h4>
<p>looks like it did</p>



<a name="187735487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735487">(Feb 08 2020 at 23:21)</a>:</h4>
<p>that mir inlining issue with #[tracked_caller] is actually the reason why I started working on the hygiene/span serialization fixes :)</p>



<a name="187735489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735489">(Feb 08 2020 at 23:21)</a>:</h4>
<p>wow</p>



<a name="187735529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735529">(Feb 08 2020 at 23:22)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> wait did you just remove the track_caller check, and tried that?</p>



<a name="187735530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735530">(Feb 08 2020 at 23:22)</a>:</h4>
<p>it was bothering me that we couldn't inline 'unwrap' without panic message regressions</p>



<a name="187735531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735531">(Feb 08 2020 at 23:22)</a>:</h4>
<p>yup</p>



<a name="187735532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735532">(Feb 08 2020 at 23:22)</a>:</h4>
<p>it seemed to work, otherwise</p>



<a name="187735535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735535">(Feb 08 2020 at 23:22)</a>:</h4>
<p>okay, so, the reason that check is there, has nothing to do with cross-crate spans</p>



<a name="187735537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735537">(Feb 08 2020 at 23:22)</a>:</h4>
<p>but the printed message changed to a macro invocation for 'unwrap'</p>



<a name="187735540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735540">(Feb 08 2020 at 23:22)</a>:</h4>
<p>there are a bunch of tests missing</p>



<a name="187735541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735541">(Feb 08 2020 at 23:22)</a>:</h4>
<p>I just added them on my branch</p>



<a name="187735544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735544">(Feb 08 2020 at 23:22)</a>:</h4>
<p>well, I didn't do any further testing after I saw that message</p>



<a name="187735545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735545">(Feb 08 2020 at 23:22)</a>:</h4>
<p>basically that check wasn't tested</p>



<a name="187735555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735555">(Feb 08 2020 at 23:23)</a>:</h4>
<p>the reason is there is because you need to somehow remember that you inlined some code</p>



<a name="187735559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735559">(Feb 08 2020 at 23:23)</a>:</h4>
<p>what do you mean?</p>



<a name="187735562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735562">(Feb 08 2020 at 23:23)</a>:</h4>
<p>From what I saw, the actual passing of the caller location happens during codegen</p>



<a name="187735564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735564">(Feb 08 2020 at 23:23)</a>:</h4>
<p>if you just inline then the <code>Span</code> won't be in the caller</p>



<a name="187735566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735566">(Feb 08 2020 at 23:23)</a>:</h4>
<p>it will be in the callee</p>



<a name="187735616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735616">(Feb 08 2020 at 23:24)</a>:</h4>
<p>codegen has to be able to walk up the "chain" of inlines, going through <code>#[track_caller]</code> ones, until it finds the actual call site that matters</p>



<a name="187735620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735620">(Feb 08 2020 at 23:24)</a>:</h4>
<p>it might be easier to show rather than tell :P</p>



<a name="187735626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735626">(Feb 08 2020 at 23:25)</a>:</h4>
<p>(since I was supposed to implement this, but got distracted by the bug you found)</p>



<a name="187735629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735629">(Feb 08 2020 at 23:25)</a>:</h4>
<p>oh, I see</p>



<a name="187735632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735632">(Feb 08 2020 at 23:25)</a>:</h4>
<p><code>expansion_cause</code> would resolve to the macro invocation location in <code>unwrap</code></p>



<a name="187735678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735678">(Feb 08 2020 at 23:26)</a>:</h4>
<p>but you don't even want to do <code>expansion_cause</code> for any span inside the <code>unwrap</code>, you want to first find the real callsite</p>



<a name="187735679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735679">(Feb 08 2020 at 23:26)</a>:</h4>
<p>which only the inliner knew, and it threw it away</p>



<a name="187735680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735680">(Feb 08 2020 at 23:26)</a>:</h4>
<p>I see</p>



<a name="187735683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735683">(Feb 08 2020 at 23:26)</a>:</h4>
<p>that's where <a href="https://github.com/rust-lang/rust/pull/68965" target="_blank" title="https://github.com/rust-lang/rust/pull/68965">https://github.com/rust-lang/rust/pull/68965</a> comes in</p>



<a name="187735689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735689">(Feb 08 2020 at 23:27)</a>:</h4>
<p>(I've been meaning to do this for a while, and the current climate of "let's turn the inliner on" is a good excuse to do it for debuginfo)</p>



<a name="187735692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735692">(Feb 08 2020 at 23:27)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> anyway this would've been obvious if tests were added which actually turned the inliner on lol</p>



<a name="187735742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735742">(Feb 08 2020 at 23:28)</a>:</h4>
<p>so, it sounds like the hygiene change might not even be necessary for <code>#[track_caller]</code>, lol</p>



<a name="187735744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735744">(Feb 08 2020 at 23:28)</a>:</h4>
<p><span class="user-mention" data-user-id="125294">@Aaron Hill</span> these tests now fail if you remove the check for no track_caller, from the inliner <a href="https://github.com/rust-lang/rust/pull/68965/commits/0f373ea4648e1a8334662fc7580f5b6d20607f10" target="_blank" title="https://github.com/rust-lang/rust/pull/68965/commits/0f373ea4648e1a8334662fc7580f5b6d20607f10">https://github.com/rust-lang/rust/pull/68965/commits/0f373ea4648e1a8334662fc7580f5b6d20607f10</a></p>



<a name="187735764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187735764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187735764">(Feb 08 2020 at 23:29)</a>:</h4>
<p>well, you do need the hygiene change to make it work correctly in many other cases, but it's mostly codegen rather than MIR inlining, that is affected</p>



<a name="187737802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187737802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187737802">(Feb 09 2020 at 00:41)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> sorry, got distracted, but I just pushed a commit which should solve the ICE you hit</p>



<a name="187737806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187737806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187737806">(Feb 09 2020 at 00:41)</a>:</h4>
<p>/me doesn't actually know how to test it reliably</p>



<a name="187738418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738418">(Feb 09 2020 at 01:02)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Sorry, missed the notification.</p>



<a name="187738419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738419">(Feb 09 2020 at 01:02)</a>:</h4>
<p>I'll test it now</p>



<a name="187738423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738423">(Feb 09 2020 at 01:02)</a>:</h4>
<p>nah your timing is great :D</p>



<a name="187738494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738494">(Feb 09 2020 at 01:05)</a>:</h4>
<p>I'm now testing the MIR-inliner-aware <code>#[track_caller]</code> codegen</p>



<a name="187738691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738691">(Feb 09 2020 at 01:11)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> Stage 1 builds successfully!</p>



<a name="187738693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738693">(Feb 09 2020 at 01:11)</a>:</h4>
<p>:D</p>



<a name="187738742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738742">(Feb 09 2020 at 01:12)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> did you see this btw? <a href="https://github.com/rust-lang/rust/pull/67662#discussion_r376725183" target="_blank" title="https://github.com/rust-lang/rust/pull/67662#discussion_r376725183">https://github.com/rust-lang/rust/pull/67662#discussion_r376725183</a></p>



<a name="187738747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187738747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187738747">(Feb 09 2020 at 01:12)</a>:</h4>
<p>Yeah but I haven't had a chance to circle back to it yet</p>



<a name="187739567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187739567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187739567">(Feb 09 2020 at 01:43)</a>:</h4>
<p>lol had a bit of an "opposite day" moment, if all the inlined scopes were <code>#[track_caller]</code>, I was using the MIR Call span. but that's innermost, like, in the definition of <code>Location::caller</code>, and I have to find the outermost inlined callsite instead</p>



<a name="187739620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187739620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187739620">(Feb 09 2020 at 01:45)</a>:</h4>
<p>huh, <code>const-caller-location.rs</code> will force me to implement the same loop for miri, this is a pleasant surprise</p>



<a name="187740426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740426">(Feb 09 2020 at 02:12)</a>:</h4>
<p>A full bootstrap completes successfully and only the "expected" ui tests fail</p>



<a name="187740433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740433">(Feb 09 2020 at 02:13)</a>:</h4>
<p>you mean the track_caller stuff?</p>



<a name="187740444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740444">(Feb 09 2020 at 02:13)</a>:</h4>
<p>The latest changes in <a href="https://github.com/rust-lang/rust/issues/68965" target="_blank" title="https://github.com/rust-lang/rust/issues/68965">#68965</a></p>



<a name="187740493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740493">(Feb 09 2020 at 02:14)</a>:</h4>
<p>well they ain't gonna fail now :P</p>



<a name="187740495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740495">(Feb 09 2020 at 02:14)</a>:</h4>
<p>oh sorry</p>



<a name="187740498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740498">(Feb 09 2020 at 02:14)</a>:</h4>
<p>just pushed codegen+miri support for inlined #[track_caller]</p>



<a name="187740501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740501">(Feb 09 2020 at 02:14)</a>:</h4>
<p>There's a small number of ui tests that fail even on <code>master</code> if you enable the inliner pass</p>



<a name="187740506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740506">(Feb 09 2020 at 02:15)</a>:</h4>
<p>aaah I see</p>



<a name="187740516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740516">(Feb 09 2020 at 02:15)</a>:</h4>
<p>OOOOH so that's what you do. I feel dumb now. okay that makes this easier to test heh</p>



<a name="187740521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740521">(Feb 09 2020 at 02:15)</a>:</h4>
<p>Which is just to say, your PR looks good to me</p>



<a name="187740522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740522">(Feb 09 2020 at 02:15)</a>:</h4>
<p>are they like, backtraces? because that means debuginfo is next on the menu :P</p>



<a name="187740564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740564">(Feb 09 2020 at 02:16)</a>:</h4>
<p>Lol, yeah it's literally just:</p>
<div class="codehilite"><pre><span></span><span class="gh">diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs</span>
<span class="gh">index 1a057500dae..26da57e41f1 100644</span>
<span class="gd">--- a/src/librustc_mir/transform/inline.rs</span>
<span class="gi">+++ b/src/librustc_mir/transform/inline.rs</span>
<span class="gu">@@ -37,7 +37,7 @@ struct CallSite&lt;&#39;tcx&gt; {</span>

 impl&lt;&#39;tcx&gt; MirPass&lt;&#39;tcx&gt; for Inline {
     fn run_pass(&amp;self, tcx: TyCtxt&lt;&#39;tcx&gt;, source: MirSource&lt;&#39;tcx&gt;, body: &amp;mut BodyAndCache&lt;&#39;tcx&gt;) {
<span class="gd">-        if tcx.sess.opts.debugging_opts.mir_opt_level &gt;= 2 {</span>
<span class="gi">+        if tcx.sess.opts.debugging_opts.mir_opt_level &gt;= 1 {</span>
             Inliner { tcx, source }.run_pass(body);
         }
     }
</pre></div>



<a name="187740579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740579">(Feb 09 2020 at 02:16)</a>:</h4>
<p>I know at least one of them is</p>



<a name="187740640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740640">(Feb 09 2020 at 02:20)</a>:</h4>
<p>I can play with that while the try build/perf run is going</p>



<a name="187740689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740689">(Feb 09 2020 at 02:20)</a>:</h4>
<div class="codehilite"><pre><span></span>failures:
    [ui] ui/async-await/async-closure.rs
    [ui] ui/backtrace-debuginfo.rs
    [ui] ui/issues/issue-22638.rs
    [ui] ui/type_length_limit.rs

test result: FAILED. 9565 passed; 4 failed; 50 ignored; 0 measured; 0 filtered out
</pre></div>



<a name="187740701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740701">(Feb 09 2020 at 02:20)</a>:</h4>
<p>ugh the "type length" limit is such a silly thing</p>



<a name="187740703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740703">(Feb 09 2020 at 02:20)</a>:</h4>
<p>I don't even know if it protects us from anything real anymore</p>



<a name="187740704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740704">(Feb 09 2020 at 02:21)</a>:</h4>
<p>It looks like it's complaining because the test is passing now?</p>



<a name="187740707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740707">(Feb 09 2020 at 02:21)</a>:</h4>
<p>lmao</p>



<a name="187740708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740708">(Feb 09 2020 at 02:21)</a>:</h4>
<div class="codehilite"><pre><span></span>---- [ui] ui/type_length_limit.rs stdout ----

error: ui test compiled successfully!
status: exit code: 0
command: &quot;/home/wesley/code/rust/rust3/build/x86_64-unknown-linux-gnu/stage2/bin/rustc&quot; &quot;/home/wesley/code/rust/rust3/src/test/ui/type_length_limit.rs&quot; &quot;-Zthreads=1&quot; &quot;--target=x86_64-unknown-linux-gnu&quot; &quot;--error-format&quot; &quot;json&quot; &quot;-Zui-testing&quot; &quot;-Zdeduplicate-diagnostics=no&quot; &quot;-C&quot; &quot;prefer-dynamic&quot; &quot;--out-dir&quot; &quot;/home/wesley/code/rust/rust3/build/x86_64-unknown-linux-gnu/test/ui/type_length_limit&quot; &quot;-Crpath&quot; &quot;-O&quot; &quot;-Cdebuginfo=0&quot; &quot;-Zunstable-options&quot; &quot;-Lnative=/home/wesley/code/rust/rust3/build/x86_64-unknown-linux-gnu/native/rust-test-helpers&quot; &quot;-L&quot; &quot;/home/wesley/code/rust/rust3/build/x86_64-unknown-linux-gnu/test/ui/type_length_limit/auxiliary&quot; &quot;-A&quot; &quot;unused&quot;
</pre></div>



<a name="187740710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740710">(Feb 09 2020 at 02:21)</a>:</h4>
<p>needs more <code>#[inline(never)]</code></p>



<a name="187740760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740760">(Feb 09 2020 at 02:22)</a>:</h4>
<p>feel free to play around with the non-debuginfo ones, I'm also seeing <code>codegen-units</code> tests also failing because of too much inlining :P</p>



<a name="187740767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740767">(Feb 09 2020 at 02:23)</a>:</h4>
<p>Could be yeah. I haven't looked at the rest of the test suite yet</p>



<a name="187740810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740810">(Feb 09 2020 at 02:24)</a>:</h4>
<p>I mean, if it's not a debuginfo/backtrace test, it likely wants some <code>#[inline(never)]</code></p>



<a name="187740858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740858">(Feb 09 2020 at 02:26)</a>:</h4>
<p>Is <code>type_length_limit</code> enforced at codegen time or something?</p>



<a name="187740861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740861">(Feb 09 2020 at 02:26)</a>:</h4>
<p>sort of. it's a silly thing</p>



<a name="187740864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740864">(Feb 09 2020 at 02:26)</a>:</h4>
<p>we should just remove it</p>



<a name="187740871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740871">(Feb 09 2020 at 02:27)</a>:</h4>
<p>I think it made more sense before we stopped giving LLVM things names by default</p>



<a name="187740875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187740875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187740875">(Feb 09 2020 at 02:27)</a>:</h4>
<p>there are a bunch of issues around it too, it's not DAG-like enough and so has false positives</p>



<a name="187755073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187755073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187755073">(Feb 09 2020 at 11:07)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> love to write a loop and worry about it being a measurable slowdown and be right</p>



<a name="187767828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187767828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187767828">(Feb 09 2020 at 18:22)</a>:</h4>
<p>that took me far too long, I guess this is what I get for tiring myself out yesterday</p>



<a name="187782596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187782596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187782596">(Feb 10 2020 at 01:27)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> <span class="user-mention" data-user-id="125250">@Wesley Wiser</span> okay I realized too late, but to avoid things getting too ugly and confusing, I'll have to move some code from cg_llvm to cg_ssa. I'll have to finish this tomorrow, and I'll try to keep the diff small</p>



<a name="187782598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187782598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187782598">(Feb 10 2020 at 01:27)</a>:</h4>
<p>overall I'm pretty confident I can pull it off, it's just a matter of passing all the right data around</p>



<a name="187782604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187782604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187782604">(Feb 10 2020 at 01:27)</a>:</h4>
<p>(this is for inlining debuginfo)</p>



<a name="187841390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187841390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187841390">(Feb 10 2020 at 18:12)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> split the <code>Instance::resolve</code> fix into <a href="https://github.com/rust-lang/rust/pull/69036" target="_blank" title="https://github.com/rust-lang/rust/pull/69036">https://github.com/rust-lang/rust/pull/69036</a></p>



<a name="187841595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187841595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187841595">(Feb 10 2020 at 18:14)</a>:</h4>
<p>I'll review tonight after I can play with it a bit</p>



<a name="187841729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187841729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187841729">(Feb 10 2020 at 18:16)</a>:</h4>
<p>frankly idk who should review, but it's basically being conservative, and codegen can't hit that case today so I don't think it cause any issues even if it's stricter than it needs to be</p>



<a name="187842360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187842360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187842360">(Feb 10 2020 at 18:23)</a>:</h4>
<p>We can get somebody else to review as well, that's fine :)</p>



<a name="187842784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187842784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187842784">(Feb 10 2020 at 18:28)</a>:</h4>
<p>I guess what I'm worried about is <span class="user-mention" data-user-id="116009">@nikomatsakis</span> finding out about this after the fact or something, and having objections</p>



<a name="187847976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187847976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187847976">(Feb 10 2020 at 19:11)</a>:</h4>
<p>We could hold off merging until after the compiler team triage meeting. Nominating or bringing it up as an announcement would at least give <span class="user-mention" data-user-id="116009">@nikomatsakis</span> and others a heads up that they might want to take a look.</p>



<a name="187848005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187848005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187848005">(Feb 10 2020 at 19:11)</a>:</h4>
<p>feel free to do it <em>shrug</em></p>



<a name="187866125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187866125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187866125">(Feb 10 2020 at 22:34)</a>:</h4>
<p>hmm I don't think I need to move anything, just expose <code>DILocation</code> properly</p>



<a name="187867200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187867200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187867200">(Feb 10 2020 at 22:49)</a>:</h4>
<p>okay I did find a reason but it's not really necessary I don't think?</p>



<a name="187871463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871463">(Feb 11 2020 at 00:01)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> first test run with the inliner enabled and debuginfo support, I'm hyped :D</p>



<a name="187871470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871470">(Feb 11 2020 at 00:01)</a>:</h4>
<p>it was pretty easy once all the pieces were in place, but reducing the refactors needed broke my brain yesterday</p>



<a name="187871515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871515">(Feb 11 2020 at 00:02)</a>:</h4>
<p>Woohoo! <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="187871546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871546">(Feb 11 2020 at 00:03)</a>:</h4>
<p>Here's hoping for lots of green on perf.rlo</p>



<a name="187871673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871673">(Feb 11 2020 at 00:06)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> backtrace test passed!!!</p>



<a name="187871725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871725">(Feb 11 2020 at 00:06)</a>:</h4>
<p>all the other mostly unrelated nonsense is still there ofc, I think I'll let you handle it and try to go back to whatever I was doing lol</p>



<a name="187871732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871732">(Feb 11 2020 at 00:06)</a>:</h4>
<p>Haha</p>



<a name="187871755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871755">(Feb 11 2020 at 00:06)</a>:</h4>
<p>Oh, is there a way to see what async closures desugar to?</p>



<a name="187871760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871760">(Feb 11 2020 at 00:07)</a>:</h4>
<p>I have a few local FIXMEs for speeding up the inliner, I guess I can do them tomorrow but now I just want to go home and sleep</p>



<a name="187871774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871774">(Feb 11 2020 at 00:07)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> --unpretty=hir, maybe?</p>



<a name="187871781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871781">(Feb 11 2020 at 00:07)</a>:</h4>
<p>Ah ok</p>



<a name="187871786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871786">(Feb 11 2020 at 00:07)</a>:</h4>
<p>if it still even exists anymore</p>



<a name="187871788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871788">(Feb 11 2020 at 00:07)</a>:</h4>
<p>Go sleep :)</p>



<a name="187871905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871905">(Feb 11 2020 at 00:09)</a>:</h4>
<p>(the FIXMEs I have are about the <code>BasicBlock</code>, <code>SourceScope</code> and <code>Local</code> mappings - the latter  two use an <code>IndexVec&lt;T, T&gt;</code> but it should really be a single e.g. <code>first_inlined_local: Local</code>,  perhaps <code>inlined_locals: RangeFrom&lt;Local&gt;</code> for semantic clarity, and then mapping is just addition)</p>



<a name="187871986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187871986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187871986">(Feb 11 2020 at 00:10)</a>:</h4>
<blockquote>
<p>and then mapping is just addition</p>
</blockquote>
<p>Oh excellent! That's awesome</p>



<a name="187872005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187872005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187872005">(Feb 11 2020 at 00:11)</a>:</h4>
<p>we already do it for blocks :P</p>



<a name="187872011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187872011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187872011">(Feb 11 2020 at 00:11)</a>:</h4>
<p>just very haphazardly</p>



<a name="187872056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187872056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187872056">(Feb 11 2020 at 00:11)</a>:</h4>
<p>Yeah</p>



<a name="187872798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/187872798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#187872798">(Feb 11 2020 at 00:24)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> pushed, knock yourself out :D</p>



<a name="188004473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188004473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188004473">(Feb 12 2020 at 12:17)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> do you happen to know if there is a way to compact DWARF units together, kind of like an LTO thing, but cheaper because it's DWARF-only?</p>



<a name="188004476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188004476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188004476">(Feb 12 2020 at 12:17)</a>:</h4>
<p>like maybe some tool or something</p>



<a name="188004531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188004531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188004531">(Feb 12 2020 at 12:18)</a>:</h4>
<p>I don't know who to ask lol, this debuginfo journey led me to <a href="https://github.com/rust-lang/rust/pull/69080" target="_blank" title="https://github.com/rust-lang/rust/pull/69080">https://github.com/rust-lang/rust/pull/69080</a> and it feels like there's still a lot more to cut down from it</p>



<a name="188006164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188006164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188006164">(Feb 12 2020 at 12:42)</a>:</h4>
<p>You may want to read section 3.1 of the DWARF5 spec. It describes <code>DW_TAG_partial_unit</code> and <code>DW_TAG_type_unit</code> which are as I understad it are used to share debuginfo between multiple compilation units.</p>



<a name="188006464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188006464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188006464">(Feb 12 2020 at 12:46)</a>:</h4>
<p>They are introduced in DWARF5, with a similar thing (.debug_types) introduced in DWARF4 and removed again in DWARF5.</p>



<a name="188006724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188006724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188006724">(Feb 12 2020 at 12:51)</a>:</h4>
<p>we generate .debug_types heh</p>



<a name="188006970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188006970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188006970">(Feb 12 2020 at 12:55)</a>:</h4>
<p>I thought we targeted DWARF3 for MacOS.</p>



<a name="188006998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188006998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188006998">(Feb 12 2020 at 12:55)</a>:</h4>
<p>I mean, I'm not on macOS, but I did see that in the source code last night by happenstance and it's gated on the target so it only affects macOS builds</p>



<a name="188007169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007169">(Feb 12 2020 at 12:58)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> so the problem IMO is that there's no step where debuginfo from different codegen units is combined together in any way, so even if "partial unit" exists as a concept, there's nothing creating it. am I confused here? all I see in the <code>llvm-dwarfdump</code> output for <code>librustc_driver-*.so</code> is <del>a gazillion</del> 5267 instances of <code>DW_TAG_compile_unit</code></p>



<a name="188007213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007213">(Feb 12 2020 at 12:59)</a>:</h4>
<p>arguably a smart enough linker could take those 5267 instances of <code>DW_TAG_compile_unit</code> and make a single <code>DW_TAG_compile_unit</code>, right?</p>



<a name="188007304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007304">(Feb 12 2020 at 13:00)</a>:</h4>
<p>I think the purpose of partial units is that you emit common types once, and then reference them from compilation units; avoiding duplicates at the codegen level, instead of linking level.</p>



<a name="188007364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007364">(Feb 12 2020 at 13:01)</a>:</h4>
<blockquote>
<p>arguably a smart enough linker could take those 5267 instances of <code>DW_TAG_compile_unit</code> and make a single <code>DW_TAG_compile_unit</code>, right?</p>
</blockquote>
<p>On non macOS systems the linker doesn't know anything about debuginfo. DWARF is made to have concatable sections for this reason.</p>



<a name="188007599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007599">(Feb 12 2020 at 13:04)</a>:</h4>
<p>ah but in this case I got rid of the types, so the only duplication is from things like function names, I think?</p>



<a name="188007604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007604">(Feb 12 2020 at 13:04)</a>:</h4>
<p>and file names</p>



<a name="188007639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188007639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188007639">(Feb 12 2020 at 13:05)</a>:</h4>
<blockquote>
<p>On non macOS systems the linker doesn't know anything about debuginfo.</p>
</blockquote>
<p>right, I mean a hypothetical linker. or some other tool</p>



<a name="188009865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/188009865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#188009865">(Feb 12 2020 at 13:35)</a>:</h4>
<blockquote>
<p>ah but in this case I got rid of the types, so the only duplication is from things like function names, I think?</p>
</blockquote>
<p>I think so, strings and <code>DW_TAG_subprocedure</code> and lineinfo for functions that are instantiated multiple times are duplicated. Though in case of <code>DW_TAG_subprocedure</code> and lineinfo the exact contents will differ, as they refer to a different instantiation of the function. I don't think any otber things are duplicated.</p>



<a name="191155275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155275">(Mar 19 2020 at 18:23)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> came back to this PR and what the hell <a href="https://github.com/rust-lang/rust/pull/68965#issuecomment-601340346" target="_blank" title="https://github.com/rust-lang/rust/pull/68965#issuecomment-601340346">https://github.com/rust-lang/rust/pull/68965#issuecomment-601340346</a></p>



<a name="191155525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155525">(Mar 19 2020 at 18:24)</a>:</h4>
<p>wut???</p>



<a name="191155831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155831">(Mar 19 2020 at 18:27)</a>:</h4>
<p>I'm dying to know</p>



<a name="191155884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155884">(Mar 19 2020 at 18:27)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> <a href="https://github.com/rust-lang/rust/issues/69060" target="_blank" title="https://github.com/rust-lang/rust/issues/69060">#69060</a> needs fixing</p>



<a name="191155899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155899">(Mar 19 2020 at 18:27)</a>:</h4>
<p>and I'm not sure how to best investigate it</p>



<a name="191155982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191155982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191155982">(Mar 19 2020 at 18:28)</a>:</h4>
<p>maybe you could look into the query counts and reproduce them differing between consecutive builds?</p>



<a name="191156045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156045">(Mar 19 2020 at 18:28)</a>:</h4>
<p>if it doesn't depend on the compiler build it might not be as hard to reduce</p>



<a name="191156052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156052">(Mar 19 2020 at 18:28)</a>:</h4>
<p>I randomly picked another recent run and <code>cranelift-codegen-debug</code> shows a slight variance there too</p>



<a name="191156065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156065">(Mar 19 2020 at 18:28)</a>:</h4>
<p><a href="https://perf.rust-lang.org/compare.html?start=d939f708d960161d23b964309ba68ff207fc0ead&amp;end=f509b26a7730d721ef87423a72b3fdf8724b4afa&amp;stat=instructions:u" target="_blank" title="https://perf.rust-lang.org/compare.html?start=d939f708d960161d23b964309ba68ff207fc0ead&amp;end=f509b26a7730d721ef87423a72b3fdf8724b4afa&amp;stat=instructions:u">https://perf.rust-lang.org/compare.html?start=d939f708d960161d23b964309ba68ff207fc0ead&amp;end=f509b26a7730d721ef87423a72b3fdf8724b4afa&amp;stat=instructions:u</a></p>



<a name="191156105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156105">(Mar 19 2020 at 18:29)</a>:</h4>
<p>It's only 3 query executions there</p>



<a name="191156121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156121">(Mar 19 2020 at 18:29)</a>:</h4>
<p>yeah we should reduce one of those crates</p>



<a name="191156170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156170">(Mar 19 2020 at 18:29)</a>:</h4>
<p>timings are hard to make decisions based off properly, but query counts are discrete</p>



<a name="191156223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156223">(Mar 19 2020 at 18:30)</a>:</h4>
<p>there's no way in hell they should change without the code changing to perform more queries</p>



<a name="191156316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156316">(Mar 19 2020 at 18:30)</a>:</h4>
<p>Another one <a href="https://perf.rust-lang.org/detailed-query.html?commit=6724d584b8e3b5fa5e06466d1e900cdd60953707&amp;base_commit=57e1da59cd0761330b4ea8d47b16340a78eeafa9&amp;benchmark=cranelift-codegen-debug&amp;run_name=clean%20incremental" target="_blank" title="https://perf.rust-lang.org/detailed-query.html?commit=6724d584b8e3b5fa5e06466d1e900cdd60953707&amp;base_commit=57e1da59cd0761330b4ea8d47b16340a78eeafa9&amp;benchmark=cranelift-codegen-debug&amp;run_name=clean%20incremental">https://perf.rust-lang.org/detailed-query.html?commit=6724d584b8e3b5fa5e06466d1e900cdd60953707&amp;base_commit=57e1da59cd0761330b4ea8d47b16340a78eeafa9&amp;benchmark=cranelift-codegen-debug&amp;run_name=clean%20incremental</a></p>



<a name="191156324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156324">(Mar 19 2020 at 18:30)</a>:</h4>
<p>or just as weird, less</p>



<a name="191156330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156330">(Mar 19 2020 at 18:30)</a>:</h4>
<p>It's always those two queries</p>



<a name="191156365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156365">(Mar 19 2020 at 18:30)</a>:</h4>
<p>do you have time to dig into this?</p>



<a name="191156406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/191156406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#191156406">(Mar 19 2020 at 18:30)</a>:</h4>
<p>Not like right this moment but I am interested</p>



<a name="192094861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/192094861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#192094861">(Mar 28 2020 at 00:10)</a>:</h4>
<p>oh this is the thread I was thinking of recently. ended up investigating myself, looks like it's mostly from the commit hash in <code>rustc -vV</code></p>



<a name="192150692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/preserving%20debuginfo%20in%20optimizations/near/192150692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/preserving.20debuginfo.20in.20optimizations.html#192150692">(Mar 29 2020 at 01:35)</a>:</h4>
<p>For anyone following along, there's additional info here <a href="https://github.com/rust-lang/rust/issues/69060#issuecomment-604928032" title="https://github.com/rust-lang/rust/issues/69060#issuecomment-604928032">https://github.com/rust-lang/rust/issues/69060#issuecomment-604928032</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>